package com.ruoyi.develop.factory.factoryTestStandard.service.impl;

import java.util.List;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.ruoyi.develop.factory.factoryTestStandard.mapper.FactoryTestStandardMapper;
import com.ruoyi.develop.factory.factoryTestStandard.domain.FactoryTestStandard;
import com.ruoyi.develop.factory.factoryTestStandard.service.IFactoryTestStandardService;

/**
 * 检验标准Service业务层处理
 *
 * @author lmm
 * @date 2024-12-25
 */
@Service
public class FactoryTestStandardServiceImpl implements IFactoryTestStandardService {
    @Resource
    private FactoryTestStandardMapper factoryTestStandardMapper;

    /**
     * 查询检验标准
     *
     * @param id 检验标准主键
     * @return 检验标准
     */
    @Override
    public FactoryTestStandard selectById(String id) {
        return factoryTestStandardMapper.selectById(id);
    }

    /**
     * 查询检验标准列表
     *
     * @param entity 检验标准
     * @return 检验标准
     */
    @Override
    public List<FactoryTestStandard> selectList(FactoryTestStandard entity) {
        return factoryTestStandardMapper.selectList(entity);
    }

    /**
     * 新增检验标准
     *
     * @param entity 检验标准
     * @return 结果
     */
    @Override
    public int insert(FactoryTestStandard entity) {
        if (StringUtils.isBlank(entity.getId())) {
            entity.setId(IdUtils.fastSimpleUUID());
        }
        entity.setCreateBy(SecurityUtils.getUsername());
        entity.setCreateTime(DateUtils.getNowDate());
        return factoryTestStandardMapper.insert(entity);
    }

    /**
     * 修改检验标准
     *
     * @param entity 检验标准
     * @return 结果
     */
    @Override
    public int update(FactoryTestStandard entity) {
        entity.setUpdateBy(SecurityUtils.getUsername());
        entity.setUpdateTime(DateUtils.getNowDate());
        return factoryTestStandardMapper.update(entity);
    }

    /**
     * 批量删除检验标准
     *
     * @param ids 需要删除的检验标准主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return factoryTestStandardMapper.deleteByIds(ids);
    }

    /**
     * 删除检验标准信息
     *
     * @param id 检验标准主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return factoryTestStandardMapper.deleteById(id);
    }

    @Override
    public int deleteByIdPhysics(String id) {
        return factoryTestStandardMapper.deleteByIdPhysics(id);
    }


}
